#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>

int main() {
    int n, m;
    int max = 0;
    int min = 100;
    scanf("%d", &n);
    for (int i = 0; i < n; i++) {
        scanf("%d", &m);
        if (m > max)
            max = m;
        if (m < min)
            min = m;
    }
    printf("%d", max - min);
    return 0;
}